本文不定期更新
1.swift点击按钮界面跳转
@IBAction func goListButton(sender: UIButton) {
let myStroyBoard = self.storyboard
let listView:UIViewController = (myStroyBoard?.instantiateViewControllerWithIdentifier("list"))!
// self.presentViewController(listView, animated: true, completion: nil)
//上面这句表示,从下向上跳出一个controller
self.navigationController?.pushViewController(listView, animated: true)
}
2.swift UILabel居中
label1.textAlignment=NSTextAlignment.Left
label2.textAlignment=NSTextAlignment.Center
label3.textAlignment=NSTextAlignment.Right
3.swift中tableView的cell点击无色
cell.selectionStyle = UITableViewCellSelectionStyle.None
4.关于swift中let 和 var的用法举例说明
例:特定类型数组的用法
//读取数组中的颜色
var colorArray:[UIColor] = [UIColor .greenColor(), UIColor .blackColor(), UIColor.orangeColor(), UIColor.grayColor(), UIColor.yellowColor(), UIColor.blueColor(), UIColor.brownColor(), UIColor.blackColor(), UIColor.purpleColor(), UIColor.redColor()]
let value = Int(arc4random() % 10)
let color = self.colorArray[value]
button.setTitle(self.array[value], forState: UIControlState.Normal)
button.setTitleColor(color, forState: UIControlState.Normal)
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。